<?php

/**
 * @author xxxxxx
 * @copyright 2008
 */

abstract class module
{
	public $name;
	public $events;
	
	public function __construct(){}
	
	public function destroy()
	{
		//unset($mm->{$this->name});
	}
	
	protected function _initialize()
	{
		$this->events = new eventHooks();
	}
	
	public function fire($hook)
	{
		foreach ($this->events->hooks[$hook] as $hooks_row)
		{
			if ($hooks_row['callback'][0]=='$me')
			{
				$hooks_row['callback'][0]=$this;
			}
			call_user_func_array($hooks_row['callback'], @array_merge(array(($hooks_row['parameters'][0]=='$me') ? $this : null), $hooks_row['parameters']));
		}
	}
	
	public function __toString()
	{
		return $this->name;
	}
}

?>